package com.lyl.springcloud.controller;

import com.lyl.springcloud.model.Result;
import com.lyl.springcloud.service.OrderFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lylbell
 * @date 2021-05-25 17:11
 */
@RestController
public class OrderController {

    @Resource
    private OrderFeignService orderFeignService;

    //getForObject返回的对象为响应体中数据转化的对象，基本上可以理解为JSON
    @GetMapping("/consumer/payment/getById/{id}")
    public Result getById(@PathVariable Long id) {
       return orderFeignService.getPayment(id);
    }

    @GetMapping("/consumer/payment/timeout")
    public String feignTimeOut() {
        return orderFeignService.feignTimeOut();//客户端一般默认等待1秒钟
    }
}
